﻿using System;
using System.Collections.Generic;
using FluentNHibernate.Automapping;
using FluentNHibernate.Automapping.Alterations;


namespace Wikey.Entity {
    public class Page : Entity<int> {
        public IEnumerable<Page> SubPages { get; set;}

        public Space Space { get; set; }
        public string Name { get; set; }
        public Page Parent { get; set; }
        public string FriendlyName { get; set; }
        public bool Published { get; set; }
        public int ViewCount { get; set; }
        public string Description { get; set; }
        public DateTime CreatedAt { get; set; }
        public DateTime ModifiedAt { get; set; }
        public IList<PageContentNode> PageContentNodes {get;set;}
        public IList<Comment> Comments { get; set; }
        public IList<Document> Documents { get; set; }
        public string Tags { get; set; }
        public User CreatedBy { get; set; }
        public User ModifiedBy { get; set; }
        public IList<Tag> TagList { get; set; }
        public Page()
        {
            Id = 0;
            Comments = new List<Comment>();
            Documents = new List<Document>();
            PageContentNodes = new List<PageContentNode>();
            Published = false;
            ViewCount = 0;
            Tags = String.Empty;
        }
    }

    public class PageOverride : IAutoMappingOverride<Page>
    {

        public void Override(AutoMapping<Page> mapping)
        {
            //mapping.Map(t => t.Content).CustomType("StringClob").CustomSqlType(("text"));
        }
    }
}
